<?php $this->load->view('layout/header'); ?>
<div class="supplier-content-page">
    <div class="product-test-h5">
        <ul class="breadcrumb">
            <li><a href="javascript:;">营销管理</a></li>
            <li><a href="javascript:;">授信管理</a></li>
            <li  class="active"><a href="javascript:;">追加授信</a></li>
        </ul>
        <div class="product-alls">
            <div class="product-fonter">追加授信</div>
            <form class="form-horizontal" action="<?php echo site_url('user_credit/appendPost')?>" method="post" id="tourismtemplet_add">
                <div class="form-group">
                    <label class="col-sm-2 control-label"><em>* </em>被授信人账号</label>
                    <div class="col-xs-6">
                        <input type="text" class="form-control" disabled="disabled" value="<?php echo ($user_name && $mobile_phone)?$user_name.' / '.$mobile_phone:($user_name?:$mobile_phone);?>" />
                        <input type="hidden" name="id" value="<?php echo $id;?>" />
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">授信总金额</label>
                    <div class="col-xs-6">
                        <input type="text" class="form-control" value="<?php echo $pay_money;?>" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">剩余授信金额</label>
                    <div class="col-xs-6">
                        <input type="text" class="form-control" value="<?php echo $nowamount;?>" readonly="readonly">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label"><em>* </em>追加授信金额</label>
                    <div class="col-xs-6">
                        <input type="text" class="form-control number required" name="amount">
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">授信描述</label>
                    <div class="col-xs-6">
                        <input type="text" class="form-control" name="note">
                    </div>
                </div>
                <div class="form-btn">
                    <a href="javascript:;">
                        <button class="btn btn-info" type="submit">保存</button>
                    </a>
                    <a href="<?php echo site_url('user_credit/grid');?>">返回上一步</a>
                </div>
            </form>
        </div>
    </div>
</div>
<?php $this->load->view('layout/footer'); ?>
<script type="text/javascript">
$(document).ready(function(){
	$('.form-horizontal').submit(function(){
        return false;
    }).validate({
        submitHandler: function(f) {
            var obj = $('button[type=submit]');
            $.ajax({
                type: 'post',
                async: false,
                dataType : 'json',
                url: hostUrl() + '/user_credit/appendPost',
                data: $('form.form-horizontal').serialize(),
                beforeSend: function() {
                    obj.text('正在保存...').attr('disabled', true);
                },
                success: function(data) {
                    if (data.status) {
                        window.location.href = data.msg;
                    } else {
                        layerMessages(data.status, data.msg);
                    }
                    obj.text('重新保存').removeAttr('disabled');
                }
            });
        }
    });
});
</script>

